public class Enrollment {
    // 属性（成员变量）
    private String studentId;
    private String courseId;
    private Double grade;
    private String enrollmentDate;

    // 构造函数
    public Enrollment() {
        // 默认构造函数
    }

    public Enrollment(String studentId, String courseId, String enrollmentDate) {
        this.studentId = studentId;
        this.courseId = courseId;
        this.enrollmentDate = enrollmentDate;
        this.grade = -1.0; // -1表示成绩未录入
    }

    // Getter方法
    public String getStudentId() {
        return studentId;
    }

    public String getCourseId() {
        return courseId;
    }

    public Double getGrade() {
        return grade;
    }

    public String getEnrollmentDate() {
        return enrollmentDate;
    }

    // Setter方法
    public void setGrade(Double grade) {
        if (grade >= 0 && grade <= 100) {
            this.grade = grade;
        }
    }

    // toString方法
    @Override
    public String toString() {
        String gradeStr = (grade == -1) ? "未录入" : String.valueOf(grade);
        return "学号: " + studentId +
                ", 课程编号: " + courseId +
                ", 成绩: " + gradeStr +
                ", 选课日期: " + enrollmentDate;
    }
}